import React from 'react';
import { render } from 'react-dom';

import ImageGallery from './ImageGallery';

ImageGallery.open = (images) => {
    if (typeof images === 'string') {
        images = images.split(',');
    }
    const div = document.createElement('div');
    document.body.appendChild(div);
    if (!Array.isArray(images)) {
        images = [images];
    }
    render(<ImageGallery
        fixed
        dataSource={images}
        onCancel={() => {document.body.removeChild(div)}}
    />, div);
};

export default ImageGallery;